package com.neuedu.elmserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neuedu.elmserver.mapper.FoodMapper;
import com.neuedu.elmserver.mapper.RecipesMapper;
import com.neuedu.elmserver.pojo.Business;
import com.neuedu.elmserver.pojo.Food;
import com.neuedu.elmserver.pojo.Recipes;
import com.neuedu.elmserver.service.FoodService;
import com.neuedu.elmserver.service.RecipesService;
import com.neuedu.elmserver.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/*
@Service
public class RecipesServiceImpl implements RecipesService {

    private final RecipesMapper recipesMapper;

    @Autowired
    public RecipesServiceImpl(RecipesMapper recipesMapper) {
        this.recipesMapper = recipesMapper;
    }

   @Override
    public ResultVO<List<Recipes>> getRecipesList() {

        List<Recipes> RecipesList = recipesMapper.selectList(null);

        return ResultVO.ok("查询成功", RecipesList);
        try {
            // 使用注入的recipesMapper实例对象来调用selectList方法
            List<Recipes> RecipesList = recipesMapper.selectList(null);
            if (RecipesList!= null &&!RecipesList.isEmpty()) {
                return ResultVO.ok("查询成功", RecipesList);
            }
            return ResultVO.fail("未查询到特色美食信息");
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVO.fail("获取特色美食列表出现异常");
        }
    }
    }*/

@Service

public class RecipesServiceImpl extends ServiceImpl<RecipesMapper, Recipes> implements RecipesService {

    @Autowired
    private RecipesMapper recipesMapper;


    /**
     * 根据level编号查询食品列表
     *
     * @param
     * @return
     */
    @Override
    public ResultVO queryRecipesList() {
        QueryWrapper qw = new QueryWrapper();
        List<Recipes> RecipesList = recipesMapper.selectList(qw);

        return ResultVO.ok("查询成功", RecipesList);


    }
}



